package com.security;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * 用来封装用户名密码信息
 */
public class UserPasswordAuthentication extends UsernamePasswordAuthenticationToken {
    private boolean rememberMe = true;

    //认证前
    public UserPasswordAuthentication(Object principal, Object credentials, boolean rememberMe) {
        super(principal, credentials);
        this.rememberMe = rememberMe;
    }

    //认证通过
    public UserPasswordAuthentication(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) {
        super(principal, credentials, authorities);
    }

    public boolean getRememberMe() {
        return rememberMe;
    }
}
